namespace ghost {
	/** 技能面板界面 此游戏没用这个*/
	export class SkillBoard extends GYSprite{
		/**攻击*/public attackBtn:SkillBtn;
		// /**跳跃*/public jumpBtn:SkillBtn;
		// /**切换*/public changeBtn:SkillBtn;
		// /**技能1*/public skill0Btn:SkillBtn;
		// /**技能2*/public skill1Btn:SkillBtn;
		// /**技能3*/public skill2Btn:SkillBtn;
		// /**技能4*/public skill3Btn:SkillBtn;
		private _skillBtns:SkillBtn[];
		private _attackRet:SkillInfoRet;
		private _jumpRet:SkillInfoRet;
		private _transRet:SkillInfoRet;
		private _openSkillList:SkillInfoRet[];
		private _round:number;
		private _roundMax:number;
		private _player:GameRole;		
		
		public constructor() {
			super();
			let s = this;
			s.width = 500;
			s.height = 500;			
			s.attackBtn = new SkillBtn(s);
			s.addChild(s.attackBtn);
			// s.jumpBtn = new SkillBtn(s);
			// s.addChild(s.jumpBtn);
			// s.changeBtn = new SkillBtn(s);
			// s.addChild(s.changeBtn);
			// s.skill0Btn = new SkillBtn(s);
			// s.addChild(s.skill0Btn);
			// s.skill1Btn = new SkillBtn(s);
			// s.addChild(s.skill1Btn);
			// s.skill2Btn = new SkillBtn(s);
			// s.addChild(s.skill2Btn);
			// s.skill3Btn = new SkillBtn(s);
			// s.addChild(s.skill3Btn);
			// s.changeBtn.visible = s.skill0Btn.visible = s.skill1Btn.visible = s.skill2Btn.visible = s.skill3Btn.visible = false;

			s.attackBtn.width = s.attackBtn.height = 200;
			// s.jumpBtn.width = s.jumpBtn.height = 120;
			// s.changeBtn.width = s.changeBtn.height = 120;
			// s.skill0Btn.width = s.skill0Btn.height = 120;
			// s.skill1Btn.width = s.skill1Btn.height = 120;
			// s.skill2Btn.width = s.skill2Btn.height = 120;
			// s.skill3Btn.width = s.skill3Btn.height = 120;

			// s.jumpBtn.right = 0;
			// s.jumpBtn.bottom = 550;
			// s.changeBtn.right = s.jumpBtn.right + s.jumpBtn.width + 50;
			// s.changeBtn.bottom = s.jumpBtn.bottom;
			s.attackBtn.right = -40;
			s.attackBtn.bottom = 90;

			// s._skillBtns = [s.skill0Btn,s.skill1Btn,s.skill2Btn,s.skill3Btn];
			// s.skill3Btn.right = s.jumpBtn.right;
			// s.skill3Btn.bottom = s.attackBtn.height + s.attackBtn.bottom + 110;

			// s.skill2Btn.right = s.skill3Btn.right + s.skill3Btn.width + 50;
			// s.skill2Btn.bottom = s.skill3Btn.bottom - 20;

			// s.skill1Btn.right = s.skill2Btn.right + s.skill2Btn.width + 10;
			// s.skill1Btn.bottom = s.skill2Btn.bottom - 110;

			// s.skill0Btn.right = s.skill1Btn.right + s.skill1Btn.width - 60;
			// s.skill0Btn.bottom = s.skill1Btn.bottom - 150;
			// s._roundMax = s._skillBtns.length;

			s._attackRet = SkillInfoRet.getSkilInfo(StsType.ATTACK,"普通攻击",1,3,true,0,0,"j");
			// s._jumpRet = SkillInfoRet.getSkilInfo(StsType.JUMP,"跳跃",1,3,true,0,0," ");
			// s._transRet = SkillInfoRet.getSkilInfo(StsType.TRANS,"切换技能",1,3,true,0,0,"[");

		}
		/**设置技能冷却UI数据
		 * @param openSkillList 技能列表
		 * @param player 操控角色
		*/
		public setData(player:GameRole,openSkillList:SkillInfoRet[]):void
		{			
			let s= this;
			s.attackBtn.setData(player,s._attackRet);
			// s.jumpBtn.setData(player,s._jumpRet);
			// s.changeBtn.setData(player,s._transRet);
			s._openSkillList = openSkillList;
			s._player = player;
			s.switchSkill(0);
		}
		public switchSkill(round:number=0):void
		{
			let s = this;
			let i:number,len:number;
			if(s._round == round)return;
			let st:number;			
			s._round = round;
			st = s._round * s._roundMax;
			len = s._openSkillList.length;
			for(i=0;i<s._roundMax;++i)
			{
				s._skillBtns[i].setData(s._player,s._openSkillList[st + i]);
			}
		}
		public get round():number
		{
			return this._round;
		}
		public excSkill(operSts:number):void
		{
			let s= this;		
			let btn:SkillBtn;			
			btn = s.getSkillBtnByOperSts(operSts);
			if(btn)
			{
				btn.tapBegin();
				btn.excSkill();	
			}
			else 
			{
				if(s._player.isSkillCoolEnd(operSts) <= 0)
					s._player.setOperSts(operSts);
				else
					console.log("技能冷却中");
			}
			
		}
		public excSkillEnd(operSts:number):void
		{
			let s= this;		
			let btn:SkillBtn;
			btn = s.getSkillBtnByOperSts(operSts);
			if(btn==null)return;
			btn.tapEnd();
		}
		public getSkillBtnByOperSts(operSts:number):SkillBtn
		{
			let s= this;
			let btn:SkillBtn;
			if(operSts == 20)
			{
				btn = s.attackBtn;
				
			}				
			// else if(operSts == 7)
			// {
			// 	btn = s.jumpBtn;					
			// }
			// else
			// {
			// 	var len:number;
			// 	len = s._skillBtns.length;
			// 	while(--len>-1)
			// 	{
			// 		if(s._skillBtns[len].skillID == operSts)
			// 		{
			// 			btn = s._skillBtns[len];
			// 			break;
			// 		}
			// 	}	
			// }
			return btn;			
		}
	}
}